package lovedna.message;
import haxe.io.BytesOutput;
import lovedna.core.Message;

/**
 * ...
 * @author liwei
 */

class Error extends Message
{
	public var id:Int;
	public var msg:String;
	public function new(id:Int,?msg:String="") 
	{
		this.id = id;
		this.msg = msg;
	}
	override public function encode():BytesOutput 
	{
		var out:BytesOutput = new BytesOutput();
		out.writeInt16(id);
		out.writeInt16(msg.length);
		out.writeString(msg);
		return out;
	}
}